<?php if (!defined('insite')) die("no access"); 
$nowitime = time();
$topitem = @filemtime("_dat/cach/top_5items"); 
require "opt.php";
global $db;

if(!$topitem || ($nowitime-$topitem>$config["top5items"]))
 {	
	ob_start();
	$item_hex_q = $db->query("SELECT  top 5 item FROM web_shop ORDER BY code DESC");
	$items_count= $db->numrows($item_hex_q);
	if ($items_count>0)
	{
	echo "<table align='center' width='80%' vAlign='top'>";
		while ($item_hex = $db->fetcharray($item_hex_q))
		{
		  echo "<tr><td align='center'>".show_items($item_hex["item"],3)."</td></tr>";
		}
	echo "</table>";
	}
	else echo "<div class='warnms'>".warning_top."</div>";
	$bufer = ob_get_contents();
	write_catch("_dat/cach/top_5items",$bufer);ob_end_clean(); echo $bufer;
 }else require "_dat/cach/top_5items";
 
?>